package cn.jiangjiesheng.bootstrap.integration.testcase;

import cn.jiangjiesheng.bootstrap.cloud.service.DevUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.servlet.MockMvc;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;

@SpringBootTest(classes = IntegrationDemoApplication.class)
@AutoConfigureMockMvc
@TestPropertySource(locations = "classpath:application.yaml")
public class AuditingTestCase {

    @Autowired
    private MockMvc mvc;

    @Test
    public void test() throws Exception {
        DevUtils.initDevUserInfoContext();
        mvc.perform(post("/auditing/datawrite?test=hello")
                .content("{\"name\":\"lisi\",\"age\":33}")
                .contentType("application/json")
        );
    }


}
